feat: add a new noble-based implementation #31
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uses
@noble/hashes
as a polyfill in newer environments where it worksAlso adds support for:
sha512-224
,sha512-256
,sha3-224
,sha3-256
,sha3-384
,sha3-512
,blake2b512
andblake2s256
Node.js-based default
./inde.js
already supports those through Node.js/OpenSSL, so different support level shouldn't be an issue. Also, the old browser impl here doesn't limitsha.js
list of supported hashes and the list depends onsha.js
version / can change outside of this lib.The new version is used only when the env supports
BigInt
and when importing noble-based implementation doesn't failSo this should be compatible with all currently supported versions and be a semver-minor change
Test changes better viewed with whitespace ignored, I had to shift the whole existing test to run it on bold old and new implementations.